package org.zjx.model.prop;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.zjx.enums.prop.ItemType;
import org.zjx.enums.prop.SlotStatus;
import org.zjx.enums.prop.SlotType;

import java.io.Serializable;

/**
 * 道具槽位 - 仅记录位置信息
 */
@Data
@NoArgsConstructor
public class ItemSlot implements Serializable {
    private static final long serialVersionUID = 1L;
    private int id;              // 槽位唯一ID
    private SlotType slotType;   // 槽位类型
    private int position;           // 槽位索引
    private SlotStatus status;   // 槽位状态

    public boolean canInput(ItemTemplate itemTemplate) {
        if (itemTemplate == null) return false;

        ItemType itemType = itemTemplate.getType();

        switch (this.slotType) {
            case EQUIPMENT:
                return itemType.isEquipment();
            case SPECIAL_EQUIP:
                return itemType == ItemType.SPECIAL_EQUIP;
            case PET_EQUIPMENT:
                return itemType == ItemType.PET_SKILL;
            case ARTIFACT_BAG:
            case EQUIPPED_ARTIFACT:
                return itemType == ItemType.TALISMAN;
            default:
                return true;
        }
    }
}